home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / Python 1.3 PPC / Tools / bgen / ae / Standard_Suite.py < prev    next >
Encoding:
Python Source  |  1995-10-11  |  16.5 KB  |  499 lines  |  [TEXT/PYTH]

  1. """Suite Standard Suite: Common terms for most applications
  2. Level 1, version 1
  3.  
  4. Generated from Moes:System folder:Extensions:Scripting Additions:Dialects:English Dialect
  5. AETE/AEUT resource version 1/0, language 0, script 0
  6. """
  7.  
  8. import addpack
  9. addpack.addpack('Tools')
  10. addpack.addpack('bgen')
  11. addpack.addpack('ae')
  12.  
  13. import aetools
  14. import MacOS
  15.  
  16. _code = 'core'
  17.  
  18. _Enum_savo = {
  19.     'yes' : 'yes ',    # Save objects now
  20.     'no' : 'no  ',    # Do not save objects
  21.     'ask' : 'ask ',    # Ask the user whether to save
  22. }
  23.  
  24. _Enum_kfrm = {
  25.     'index' : 'indx',    # keyform designating indexed access
  26.     'named' : 'name',    # keyform designating named access
  27.     'id' : 'ID  ',    # keyform designating access by unique identifier
  28. }
  29.  
  30. _Enum_styl = {
  31.     'plain' : 'plan',    # Plain
  32.     'bold' : 'bold',    # Bold
  33.     'italic' : 'ital',    # Italic
  34.     'outline' : 'outl',    # Outline
  35.     'shadow' : 'shad',    # Shadow
  36.     'underline' : 'undl',    # Underline
  37.     'superscript' : 'spsc',    # Superscript
  38.     'subscript' : 'sbsc',    # Subscript
  39.     'strikethrough' : 'strk',    # Strikethrough
  40.     'small_caps' : 'smcp',    # Small caps
  41.     'all_caps' : 'alcp',    # All capital letters
  42.     'all_lowercase' : 'lowc',    # Lowercase
  43.     'condensed' : 'cond',    # Condensed
  44.     'expanded' : 'pexp',    # Expanded
  45.     'hidden' : 'hidn',    # Hidden
  46. }
  47.  
  48. class Standard_Suite:
  49.  
  50.     _argmap_class_info = {
  51.         '_in' : 'wrcd',
  52.     }
  53.  
  54.     def class_info(self, _object=None, _attributes={}, **_arguments):
  55.         """class info: Get information about an object class
  56.         Required argument: the object class about which information is requested
  57.         Keyword argument _in: the human language and script system in which to return information
  58.         Keyword argument _attributes: AppleEvent attribute dictionary
  59.         Returns: a record containing the object’s properties and elements
  60.         """
  61.         _code = 'core'
  62.         _subcode = 'qobj'
  63.  
  64.         aetools.keysubst(_arguments, self._argmap_class_info)
  65.         _arguments['----'] = _object
  66.  
  67.  
  68.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  69.                 _arguments, _attributes)
  70.         if _arguments.has_key('errn'):
  71.             raise MacOS.Error, aetools.decodeerror(_arguments)
  72.         # XXXX Optionally decode result
  73.         if _arguments.has_key('----'):
  74.             return _arguments['----']
  75.  
  76.     _argmap_close = {
  77.         'saving' : 'savo',
  78.         'saving_in' : 'kfil',
  79.     }
  80.  
  81.     def close(self, _object, _attributes={}, **_arguments):
  82.         """close: Close an object
  83.         Required argument: the object to close
  84.         Keyword argument saving: specifies whether changes should be saved before closing
  85.         Keyword argument saving_in: the file in which to save the object
  86.         Keyword argument _attributes: AppleEvent attribute dictionary
  87.         """
  88.         _code = 'core'
  89.         _subcode = 'clos'
  90.  
  91.         aetools.keysubst(_arguments, self._argmap_close)
  92.         _arguments['----'] = _object
  93.  
  94.         aetools.enumsubst(_arguments, 'savo', _Enum_savo)
  95.  
  96.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  97.                 _arguments, _attributes)
  98.         if _arguments.has_key('errn'):
  99.             raise MacOS.Error, aetools.decodeerror(_arguments)
  100.         # XXXX Optionally decode result
  101.         if _arguments.has_key('----'):
  102.             return _arguments['----']
  103.  
  104.     _argmap_count = {
  105.         'each' : 'kocl',
  106.     }
  107.  
  108.     def count(self, _object, _attributes={}, **_arguments):
  109.         """count: Return the number of elements of a particular class within an object
  110.         Required argument: the object whose elements are to be counted
  111.         Keyword argument each: the class of the elements to be counted.
  112.         Keyword argument _attributes: AppleEvent attribute dictionary
  113.         Returns: the number of elements
  114.         """
  115.         _code = 'core'
  116.         _subcode = 'cnte'
  117.  
  118.         aetools.keysubst(_arguments, self._argmap_count)
  119.         _arguments['----'] = _object
  120.  
  121.  
  122.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  123.                 _arguments, _attributes)
  124.         if _arguments.has_key('errn'):
  125.             raise MacOS.Error, aetools.decodeerror(_arguments)
  126.         # XXXX Optionally decode result
  127.         if _arguments.has_key('----'):
  128.             return _arguments['----']
  129.  
  130.     _argmap_data_size = {
  131.         'as' : 'rtyp',
  132.     }
  133.  
  134.     def data_size(self, _object, _attributes={}, **_arguments):
  135.         """data size: Return the size in bytes of an object
  136.         Required argument: the object whose data size is to be returned
  137.         Keyword argument as: the data type for which the size is calculated
  138.         Keyword argument _attributes: AppleEvent attribute dictionary
  139.         Returns: the size of the object in bytes
  140.         """
  141.         _code = 'core'
  142.         _subcode = 'dsiz'
  143.  
  144.         aetools.keysubst(_arguments, self._argmap_data_size)
  145.         _arguments['----'] = _object
  146.  
  147.  
  148.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  149.                 _arguments, _attributes)
  150.         if _arguments.has_key('errn'):
  151.             raise MacOS.Error, aetools.decodeerror(_arguments)
  152.         # XXXX Optionally decode result
  153.         if _arguments.has_key('----'):
  154.             return _arguments['----']
  155.  
  156.     def delete(self, _object, _attributes={}, **_arguments):
  157.         """delete: Delete an element from an object
  158.         Required argument: the element to delete
  159.         Keyword argument _attributes: AppleEvent attribute dictionary
  160.         """
  161.         _code = 'core'
  162.         _subcode = 'delo'
  163.  
  164.         if _arguments: raise TypeError, 'No optional args expected'
  165.         _arguments['----'] = _object
  166.  
  167.  
  168.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  169.                 _arguments, _attributes)
  170.         if _arguments.has_key('errn'):
  171.             raise MacOS.Error, aetools.decodeerror(_arguments)
  172.         # XXXX Optionally decode result
  173.         if _arguments.has_key('----'):
  174.             return _arguments['----']
  175.  
  176.     _argmap_duplicate = {
  177.         'to' : 'insh',
  178.     }
  179.  
  180.     def duplicate(self, _object, _attributes={}, **_arguments):
  181.         """duplicate: Duplicate object(s)
  182.         Required argument: the object(s) to duplicate
  183.         Keyword argument to: the new location for the object(s)
  184.         Keyword argument _attributes: AppleEvent attribute dictionary
  185.         Returns: to the duplicated object(s)
  186.         """
  187.         _code = 'core'
  188.         _subcode = 'clon'
  189.  
  190.         aetools.keysubst(_arguments, self._argmap_duplicate)
  191.         _arguments['----'] = _object
  192.  
  193.  
  194.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  195.                 _arguments, _attributes)
  196.         if _arguments.has_key('errn'):
  197.             raise MacOS.Error, aetools.decodeerror(_arguments)
  198.         # XXXX Optionally decode result
  199.         if _arguments.has_key('----'):
  200.             return _arguments['----']
  201.  
  202.     _argmap_event_info = {
  203.         '_in' : 'wrcd',
  204.     }
  205.  
  206.     def event_info(self, _object, _attributes={}, **_arguments):
  207.         """event info: Get information about the Apple events in a suite
  208.         Required argument: the event class of the Apple events for which to return information
  209.         Keyword argument _in: the human language and script system in which to return information
  210.         Keyword argument _attributes: AppleEvent attribute dictionary
  211.         Returns: a record containing the events and their parameters
  212.         """
  213.         _code = 'core'
  214.         _subcode = 'gtei'
  215.  
  216.         aetools.keysubst(_arguments, self._argmap_event_info)
  217.         _arguments['----'] = _object
  218.  
  219.  
  220.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  221.                 _arguments, _attributes)
  222.         if _arguments.has_key('errn'):
  223.             raise MacOS.Error, aetools.decodeerror(_arguments)
  224.         # XXXX Optionally decode result
  225.         if _arguments.has_key('----'):
  226.             return _arguments['----']
  227.  
  228.     def exists(self, _object, _attributes={}, **_arguments):
  229.         """exists: Verify if an object exists
  230.         Required argument: the object in question
  231.         Keyword argument _attributes: AppleEvent attribute dictionary
  232.         Returns: true if it exists, false if not
  233.         """
  234.         _code = 'core'
  235.         _subcode = 'doex'
  236.  
  237.         if _arguments: raise TypeError, 'No optional args expected'
  238.         _arguments['----'] = _object
  239.  
  240.  
  241.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  242.                 _arguments, _attributes)
  243.         if _arguments.has_key('errn'):
  244.             raise MacOS.Error, aetools.decodeerror(_arguments)
  245.         # XXXX Optionally decode result
  246.         if _arguments.has_key('----'):
  247.             return _arguments['----']
  248.  
  249.     _argmap_make = {
  250.         'new' : 'kocl',
  251.         'at' : 'insh',
  252.         'with_data' : 'data',
  253.         'with_properties' : 'prdt',
  254.     }
  255.  
  256.     def make(self, _no_object=None, _attributes={}, **_arguments):
  257.         """make: Make a new element
  258.         Keyword argument new: the class of the new element.
  259.         Keyword argument at: the location at which to insert the element
  260.         Keyword argument with_data: the initial data for the element
  261.         Keyword argument with_properties: the initial values for the properties of the element
  262.         Keyword argument _attributes: AppleEvent attribute dictionary
  263.         Returns: to the new object(s)
  264.         """
  265.         _code = 'core'
  266.         _subcode = 'crel'
  267.  
  268.         aetools.keysubst(_arguments, self._argmap_make)
  269.         if _no_object != None: raise TypeError, 'No direct arg expected'
  270.  
  271.  
  272.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  273.                 _arguments, _attributes)
  274.         if _arguments.has_key('errn'):
  275.             raise MacOS.Error, aetools.decodeerror(_arguments)
  276.         # XXXX Optionally decode result
  277.         if _arguments.has_key('----'):
  278.             return _arguments['----']
  279.  
  280.     _argmap_move = {
  281.         'to' : 'insh',
  282.     }
  283.  
  284.     def move(self, _object, _attributes={}, **_arguments):
  285.         """move: Move object(s) to a new location
  286.         Required argument: the object(s) to move
  287.         Keyword argument to: the new location for the object(s)
  288.         Keyword argument _attributes: AppleEvent attribute dictionary
  289.         Returns: to the object(s) after they have been moved
  290.         """
  291.         _code = 'core'
  292.         _subcode = 'move'
  293.  
  294.         aetools.keysubst(_arguments, self._argmap_move)
  295.         _arguments['----'] = _object
  296.  
  297.  
  298.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  299.                 _arguments, _attributes)
  300.         if _arguments.has_key('errn'):
  301.             raise MacOS.Error, aetools.decodeerror(_arguments)
  302.         # XXXX Optionally decode result
  303.         if _arguments.has_key('----'):
  304.             return _arguments['----']
  305.  
  306.     def open(self, _object, _attributes={}, **_arguments):
  307.         """open: Open the specified object(s)
  308.         Required argument: list of objects to open
  309.         Keyword argument _attributes: AppleEvent attribute dictionary
  310.         """
  311.         _code = 'aevt'
  312.         _subcode = 'odoc'
  313.  
  314.         if _arguments: raise TypeError, 'No optional args expected'
  315.         _arguments['----'] = _object
  316.  
  317.  
  318.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  319.                 _arguments, _attributes)
  320.         if _arguments.has_key('errn'):
  321.             raise MacOS.Error, aetools.decodeerror(_arguments)
  322.         # XXXX Optionally decode result
  323.         if _arguments.has_key('----'):
  324.             return _arguments['----']
  325.  
  326.     def _print(self, _object, _attributes={}, **_arguments):
  327.         """print: Print the specified object(s)
  328.         Required argument: list of objects to print
  329.         Keyword argument _attributes: AppleEvent attribute dictionary
  330.         """
  331.         _code = 'aevt'
  332.         _subcode = 'pdoc'
  333.  
  334.         if _arguments: raise TypeError, 'No optional args expected'
  335.         _arguments['----'] = _object
  336.  
  337.  
  338.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  339.                 _arguments, _attributes)
  340.         if _arguments.has_key('errn'):
  341.             raise MacOS.Error, aetools.decodeerror(_arguments)
  342.         # XXXX Optionally decode result
  343.         if _arguments.has_key('----'):
  344.             return _arguments['----']
  345.  
  346.     _argmap_quit = {
  347.         'saving' : 'savo',
  348.     }
  349.  
  350.     def quit(self, _no_object=None, _attributes={}, **_arguments):
  351.         """quit: Quit an application program
  352.         Keyword argument saving: specifies whether to save currently open documents
  353.         Keyword argument _attributes: AppleEvent attribute dictionary
  354.         """
  355.         _code = 'aevt'
  356.         _subcode = 'quit'
  357.  
  358.         aetools.keysubst(_arguments, self._argmap_quit)
  359.         if _no_object != None: raise TypeError, 'No direct arg expected'
  360.  
  361.         aetools.enumsubst(_arguments, 'savo', _Enum_savo)
  362.  
  363.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  364.                 _arguments, _attributes)
  365.         if _arguments.has_key('errn'):
  366.             raise MacOS.Error, aetools.decodeerror(_arguments)
  367.         # XXXX Optionally decode result
  368.         if _arguments.has_key('----'):
  369.             return _arguments['----']
  370.  
  371.     _argmap_save = {
  372.         '_in' : 'kfil',
  373.         'as' : 'fltp',
  374.     }
  375.  
  376.     def save(self, _object, _attributes={}, **_arguments):
  377.         """save: Save an object
  378.         Required argument: the object to save
  379.         Keyword argument _in: the file in which to save the object
  380.         Keyword argument as: the file type of the document in which to save the data
  381.         Keyword argument _attributes: AppleEvent attribute dictionary
  382.         """
  383.         _code = 'core'
  384.         _subcode = 'save'
  385.  
  386.         aetools.keysubst(_arguments, self._argmap_save)
  387.         _arguments['----'] = _object
  388.  
  389.  
  390.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  391.                 _arguments, _attributes)
  392.         if _arguments.has_key('errn'):
  393.             raise MacOS.Error, aetools.decodeerror(_arguments)
  394.         # XXXX Optionally decode result
  395.         if _arguments.has_key('----'):
  396.             return _arguments['----']
  397.  
  398.     _argmap_suite_info = {
  399.         '_in' : 'wrcd',
  400.     }
  401.  
  402.     def suite_info(self, _object, _attributes={}, **_arguments):
  403.         """suite info: Get information about event suite(s)
  404.         Required argument: the suite for which to return information
  405.         Keyword argument _in: the human language and script system in which to return information
  406.         Keyword argument _attributes: AppleEvent attribute dictionary
  407.         Returns: a record containing the suites and their versions
  408.         """
  409.         _code = 'core'
  410.         _subcode = 'gtsi'
  411.  
  412.         aetools.keysubst(_arguments, self._argmap_suite_info)
  413.         _arguments['----'] = _object
  414.  
  415.  
  416.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  417.                 _arguments, _attributes)
  418.         if _arguments.has_key('errn'):
  419.             raise MacOS.Error, aetools.decodeerror(_arguments)
  420.         # XXXX Optionally decode result
  421.         if _arguments.has_key('----'):
  422.             return _arguments['----']
  423.  
  424.  
  425. #    Class 'application' ('capp') -- 'An application program'
  426. #        property 'clipboard' ('pcli') '****' -- 'the clipboard' [mutable list]
  427. #        property 'frontmost' ('pisf') 'bool' -- 'Is this the frontmost application?' []
  428. #        property 'name' ('pnam') 'itxt' -- 'the name' []
  429. #        property 'selection' ('sele') 'csel' -- 'the selection visible to the user' [mutable]
  430. #        property 'version' ('vers') 'vers' -- 'the version of the application' []
  431.  
  432. #    Class 'applications' ('capp') -- 'Every application'
  433. #        property '' ('c@#!') 'type' -- '' [0]
  434.  
  435. #    Class 'character' ('cha ') -- 'A character'
  436. #        property 'color' ('colr') 'cRGB' -- 'the color' [mutable]
  437. #        property 'font' ('font') 'ctxt' -- 'the name of the font' [mutable]
  438. #        property 'size' ('ptsz') 'fixd' -- 'the size in points' [mutable]
  439. #        property 'writing code' ('psct') 'intl' -- 'the script system and language' []
  440. #        property 'style' ('txst') 'tsty' -- 'the text style' [mutable]
  441. #        property 'uniform styles' ('ustl') 'tsty' -- 'the text style' []
  442.  
  443. #    Class 'characters' ('cha ') -- 'Every character'
  444. #        property '' ('c@#!') 'type' -- '' [0]
  445.  
  446. #    Class 'document' ('docu') -- 'A document'
  447. #        property 'modified' ('imod') 'bool' -- 'Has the document been modified since the last save?' []
  448.  
  449. #    Class 'documents' ('docu') -- 'Every document'
  450. #        property '' ('c@#!') 'type' -- '' [0]
  451.  
  452. #    Class 'file' ('file') -- 'A file'
  453. #        property 'stationery' ('pspd') 'bool' -- 'Is the file a stationery file?' [mutable]
  454.  
  455. #    Class 'files' ('file') -- 'Every file'
  456. #        property '' ('c@#!') 'type' -- '' [0]
  457.  
  458. #    Class 'selection-object' ('csel') -- 'the selection visible to the user'
  459. #        property 'contents' ('pcnt') 'type' -- 'the contents of the selection' []
  460.  
  461. #    Class 'text' ('ctxt') -- 'Text'
  462. #        property '' ('c@#!') 'type' -- '' [0]
  463. #        property 'font' ('font') 'ctxt' -- 'the name of the font of the first character' [mutable]
  464.  
  465. #    Class 'text style info' ('tsty') -- 'On and Off styles of text run'
  466. #        property 'on styles' ('onst') 'styl' -- 'the styles that are on for the text' [enum list]
  467. #        property 'off styles' ('ofst') 'styl' -- 'the styles that are off for the text' [enum list]
  468.  
  469. #    Class 'text style infos' ('tsty') -- 'every text style info'
  470. #        property '' ('c@#!') 'type' -- '' [0]
  471.  
  472. #    Class 'window' ('cwin') -- 'A window'
  473. #        property 'bounds' ('pbnd') 'qdrt' -- 'the boundary rectangle for the window' [mutable]
  474. #        property 'closeable' ('hclb') 'bool' -- 'Does the window have a close box?' []
  475. #        property 'titled' ('ptit') 'bool' -- 'Does the window have a title bar?' []
  476. #        property 'index' ('pidx') 'long' -- 'the number of the window' [mutable]
  477. #        property 'floating' ('isfl') 'bool' -- 'Does the window float?' []
  478. #        property 'modal' ('pmod') 'bool' -- 'Is the window modal?' []
  479. #        property 'resizable' ('prsz') 'bool' -- 'Is the window resizable?' []
  480. #        property 'zoomable' ('iszm') 'bool' -- 'Is the window zoomable?' []
  481. #        property 'zoomed' ('pzum') 'bool' -- 'Is the window zoomed?' [mutable]
  482. #        property 'visible' ('pvis') 'bool' -- 'Is the window visible?' [mutable]
  483.  
  484. #    Class 'windows' ('cwin') -- 'Every window'
  485. #        property '' ('c@#!') 'type' -- '' [0]
  486.  
  487. #    Class 'insertion point' ('cins') -- 'An insertion location between two objects'
  488.  
  489. #    Class 'insertion points' ('cins') -- 'Every insertion location'
  490. #        property '' ('c@#!') 'type' -- '' [0]
  491. #    comparison  'starts with' ('bgwt') -- Starts with
  492. #    comparison  'contains' ('cont') -- Contains
  493. #    comparison  'ends with' ('ends') -- Ends with
  494. #    comparison  '=' ('=   ') -- Equal
  495. #    comparison  '>' ('>   ') -- Greater than
  496. #    comparison  '\263' ('>=  ') -- Greater than or equal to
  497. #    comparison  '<' ('<   ') -- Less than
  498. #    comparison  '\262' ('<=  ') -- Less than or equal to
  499.